package com.wbp.cms.core.dao;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.wbp.cms.client.common.domain.QRCodeDO;
import com.wbp.cms.client.common.query.QRCodeQuery;


/**
 * @Description:
 * @Department:
 * @author andy.lhc
 * @date 2016年3月9日 下午4:42:45
 */
@Repository("qRCodeDAO")
public class QRCodeDAO extends BaseDao {

  public Long insert(QRCodeDO qrCodeDO) {
    super.insert("QRCodeMapper.insert", qrCodeDO);
    return qrCodeDO.getId();
  }
  
  public int delete(Long id ) {
    return  super.delete("QRCodeMapper.delete", id);
  }

  public int update(QRCodeDO qrCodeDO) {
    return super.update("QRCodeMapper.update", qrCodeDO);
  }

  public QRCodeDO load(Long qrCodeId) {
    Object obj = super.selectOneObject("QRCodeMapper.load", qrCodeId);
    return obj == null ? null : (QRCodeDO) obj;
  }
  
  public QRCodeDO loadByUserId(Long userId) {
    Object obj = super.selectOneObject("QRCodeMapper.loadByUserId", userId);
    return obj == null ? null : (QRCodeDO) obj;
  }

  public List<QRCodeDO> query(QRCodeQuery qRCodeQuery) {
    return super.selectList("QRCodeMapper.query", qRCodeQuery);
  }

  public Integer queryCount(QRCodeQuery qRCodeQuery) {
    Object obj = super.selectOneObject("QRCodeMapper.queryCount", qRCodeQuery);
    return obj == null ? 0 : (Integer) obj;
  }

}
